<!DOCTYPE HTML>
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <link href="../static/assets3/css/bs3/dpl-min.css" rel="stylesheet" type="text/css"/>
    <link href="../static/assets3/css/bs3/bui-min.css" rel="stylesheet" type="text/css"/>
    <link href="../static/assets/css/page-min.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="../admin/css/uploadify.css">
    <link rel="stylesheet" href="../static/layer/skin/default/layer.css"/>
</head>
<body>
<div class="container">
    <div class="row">
        <form id="searchForm" class="form-horizontal span24">
            <div class="row">
                <div class="control-group span8">
                    <label class="control-label">题目</label>

                    <div class="controls">
                        <input type="text" class="control-text" name="key" placeholder="题目">
                        <input type="text" name="aaa" style="display: none;">
                    </div>
                </div>
                <div class="span3 offset">
                    <button type="button" id="btnSearch" class="button button-primary">搜索</button>
                </div>
            </div>
        </form>
    </div>
    <div class="toolbar">
        <button id="btnBack" class="button button-primary">返回</button>
    </div>
    <div class="search-grid-container">
        <div id="grid"></div>
    </div>


</div>
</body>
<script type="text/javascript" language="javascript" src="../static/common/jquery.min-2.1.3.js"></script>
<script type="text/javascript" src="../static/layer/layer.js"></script>
<script type="text/javascript" src="../static/assets/js/bui.js"></script>
<script type="text/javascript" src="../static/assets/js/config.js"></script>
<script type="text/javascript" src="../static/common/JsUtil.js"></script>
<script type="text/javascript">
    var uid = __JsUtil.GetQuery("id");
    var title = __JsUtil.GetQuery("q");
    document.title = decodeURI(title) + "题库";
    var msg = document.title;
    msg = "…" + msg;
    pos = 0;
    function scrollMSG() {
        document.title = msg.substring(pos, msg.length) + msg.substring(0, pos);
        pos++;
        if (pos > msg.length) pos = 0
        window.setTimeout("scrollMSG()", 400);
    }
    scrollMSG();
    $(document).ready(function () {
        $("#btnBack").on("click", function () {
            location.href = document.referrer;
        });
    });
    BUI.use(['common/search', 'bui/overlay', 'common/page', 'bui/mask'], function (Search, Grid, Data, Overlay, Mask) {
        var Grid = BUI.Grid,
                columns = [
                    {title: '题目', dataIndex: 'subject', elCls: 'center'},
                    {title: '答案项', dataIndex: 'options', elCls: 'center'},
                    {title: '正确项', dataIndex: 'optionR', elCls: 'center'},
                    {
                        title: '时间', dataIndex: '', elCls: 'center', renderer: function (value, obj) {
                        var createStr = "创建时间：" + (new Date(obj.gmtCreate)).format("yyyy-MM-dd HH:mm:ss")+"<br>",
                                modifiedStr = "修改时间：" + (new Date(obj.gmtModified)).format("yyyy-MM-dd HH:mm:ss");
                        return createStr + modifiedStr;
                    }
                    }
                ],
                store = Search.createStore('../userInfo/listQues', {
                    proxy: {
                        save: { //也可以是一个字符串，那么增删改，都会往那么路径提交数据，同时附加参数saveType
                            /* addUrl : '../data/add.json',*/
                            /* updateUrl : ' ', */
                            /* removeUrl : '../data/del.php' */
                        },
                        method: 'POST'
                    },
                    params: { //配置初始请求的参数
                        uid: uid
                    },
                    pageIndex: 0,
                    pageSize: 10,
                    autoSync: true //保存数据后，自动更新
                }),
                gridCfg = Search.createGridCfg(columns, {
                    forceFit: true,
                    emptyDataTpl: '<div class="centered"><img alt="Crying" src="http://img03.taobaocdn.com/tps/i3/T1amCdXhXqXXXXXXXX-60-67.png"><h2>查询的数据不存在</h2></div>',
                    plugins: [BUI.Grid.Plugins.AutoFit, Grid.Plugins.ColumnResize] // 插件形式引入多选表格
                });

        var search = new Search({
                    store: store,
                    gridCfg: gridCfg
                }),
                grid = search.get('grid');
    });
</script>

</html>